const crawler = require('../../libs/crawler'),
      { crawlerConf } = require('../../config/config');

//执行并传参 传入callback
crawler({
  url: crawlerConf.url.main,
  callback () {
    //这个回调里面的环境就是页面的环境
		//在浏览器控制台输入 jQuery  或 $检查有没有jq
		const $ = window.$,
    $item = $('.agency-big-banner-ul .agency-big-banner-li'); //jq父子选择器
    //需要拿到的数据 轮播图li下面的 a-href title data-id img-url
    let data = [];
    $item.each((index, item) => {  //遍历
    //拿到要的元素
    const $el = $(item),
      $elLink = $el.find('.js-banner-btnqq');
      
    const dataItem = {
      cid: $elLink.attr('data-id'), //courseId
      href: $elLink.prop('href'),
      imgUrl: $elLink.find('img').prop('src').replace('webp', ''),
      title: $elLink.prop('title'),
      imgKey: ''
    }
    data.push(dataItem);
    }) 
    return data;
  }
})